<?php
	class database {
	//CLASS DATABASE
	private $dbHost = "192.168.0.102";
	private $dbUser = "root";
	private $dbPass = "";
	private $dbName = "pollingasisten";

	//METHOD KONEKSI MYSQL
	function connectMySQL(){
		mysql_connect($this->dbHost, $this->dbUser,$this->dbPass);
		mysql_select_db($this->dbName) or die("Database tidak ada!");
	}

	function InsertLogAsisten() {
		$nim = $_POST['nim'];
		$changelog = $_POST['changelog'];
		$query = "Call SpInsertLogAsisten($nim, $changelog)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertLogSuperAdmin() {
		$nim = $_POST['nim'];
		$changelog = $_POST['changelog'];
		$query = "Call SpInsertLogSuperAdmin($nim, $changelog)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertAsisten() {
		$nim = $_POST['nim'];
		$nama = $_POST['nama'];
		$query = "Call SpInsertAsisten ($nim, $nama)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertSuperAdmin() {
		$nim = $_POST['nim'];
		$nama = $_POST['nama'];
		$query = "Call SpInsertSuperAdmin($nim, $nama)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertPenilaian() {
		$kd_jadwal = $_POST['kd_jadwal'];
		$ip = $_POST['ip'];
		$query = "Call SpInsertPenilaian($kd_jadwal, $ip)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertJadwalAsisten() {
		$nim = $_POST['nim'];
		$kd_jadwal = $_POST['kd_jadwal'];
		$query = "Call SpInsertJadwalAsisten($nim, $kd_jadwal)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertMatkul() {
		$kd_jurusan = $_POST['kd_jurusan'];
		$namaMatakul = $_POST['namaMatakul'];
		$query = "Call SpInsertMatkul($kd_jurusan, $namaMatakul)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function insert_InsertJadwal() {
		$kd_matkul = $_POST['kd_matkul'];
		$lab = $_POST['lab'];
		$hari = $_POST['hari'];
		$query = "Call SpInsertJadwal($kd_jurusan, $namaMatakul)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function insert_ItemPenailaian() {
		$kd_penilaian = $_POST['kd_penilaian'];
		$nim = $_POST['nim'];
		$nilai1 = $_POST['nilai1'];
		$nilai2 = $_POST['nilai2'];
		$nilai3 = $_POST['nilai3'];
		$nilai4 = $_POST['nilai4'];
		$pesan = $_POST['pesan'];
		$query = "Call SpInsertItemPenilaian ($kd_penilaian, $nim, $nilai1, $nilai2, $nilai3, $nilai4, $nilai5, $pesan)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function InsertJurusan() {
		$kd_jurusan = $_POST['kd_jurusan']
		$namaMatakul = $_POST['namaJurusan'];
		$query = "Call SpInsertJurusan($kd_jurusan, $namaJurusan)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

	function CollectJadwal() {
		$kd_jurusan = $_POST['kd_jurusan']
		$namaMatakul = $_POST['namaJurusan'];
		$lab = $_POST['lab'];
		$hari = $_POST['hari'];
		$sesi = $_POST['sesi'];
		$kelas = $_POST['kelas'];
		$nim1 = $_POST['nim1'];
		$nim2 = $_POST['nim2'];
		$nim3 = $_POST['nim3'];
		$nim4 = $_POST['nim4'];
		$query = "Call SpCollectJadwal($kd_jurusan, $namaJurusan)";
		$hasil = mysql_query($query) or exit(mysql_error());
	}

